
#pragma once

#if 0
YME, Copyright 2023 Constantine Tarasenkov (iamvfx@gmail.com), licensed under MIT License.
#endif

#if 0
Dependencies:
* NVIDIA GeForce Graphics Drivers 536.67 WHQL from July 18th, 2023 or higher
* GLFW 3.4.0 (commit 88a39006e3407656a7ca33d23f8045c6aca43008)
* Dear ImGui 1.88 WIP (IMGUI_VERSION_NUM 18731, commit 37a07858a913be5b4e932fcb38857566f24ff47a)
* cimgui (commit 08d5ad7f93eb169377c20bd42748877a41759b63)
#endif

#include <stdint.h>

typedef void (*YmeSetCurrentScene)(void * ptrTo_m_app__App, const char * media_nameDotSceneDotJson, int isForceReload);
typedef void (*YmeGetCurrentScenePointer)(void * ptrTo_m_app__App, void ** out_p_m_Scene__donut_engine_ExtendedScene);
typedef void (*YmeGetCurrentSceneName)(void * ptrTo_m_app__App, const char ** outSceneName);
typedef void (*YmeSetCurrentSceneName)(void * ptrTo_m_app__App, const char * sceneName);
typedef void (*YmeAppBaseSetAsynchronousLoadingEnabled)(void * ptrTo_m_app__App, int isEnabled);
typedef void (*YmeAppBaseBeginLoadingScene)(void * ptrTo_m_app__App, const char * localPathTo_nameDotSceneDotJson);
typedef void (*YmeAppBaseIsSceneLoading)(void * ptrTo_m_app__App, int * outIsLoading);
typedef void (*YmeAppBaseIsSceneLoaded)(void * ptrTo_m_app__App, int * outIsLoaded);
typedef void (*YmeAppGetResolutionInfo)(void * ptrTo_m_app__App, u32 * outNativeResolutionWidth, u32 * outNativeResolutionHeight, u32 * outFinalResolutionWidth, u32 * outFinalResolutionHeight);
typedef void (*YmeCameraUpdate)(void * ptrTo_camera__donut_app_FirstPersonCamera, f32 positionVectorX, f32 positionVectorY, f32 positionVectorZ, f32 directionVectorX, f32 directionVectorY, f32 directionVectorZ, f32 upVectorX, f32 upVectorY, f32 upVectorZ, f32 rightVectorX, f32 rightVectorY, f32 rightVectorZ);
typedef void (*YmeDonutMathRotationQuatFromEulerRad)(f32 eulerX, f32 eulerY, f32 eulerZ, f32 * outQuatX, f32 * outQuatY, f32 * outQuatZ, f32 * outQuatW);
typedef void (*YmeDonutMathRotationQuatFromAxisAngleRad)(f32 axisX, f32 axisY, f32 axisZ, f32 angle, f32 * outQuatX, f32 * outQuatY, f32 * outQuatZ, f32 * outQuatW);
typedef void (*YmeDonutMathQuatToFloat3x3)(f32 quatX, f32 quatY, f32 quatZ, f32 quatW, f32 * outMatrix_row0_x, f32 * outMatrix_row0_y, f32 * outMatrix_row0_z, f32 * outMatrix_row1_x, f32 * outMatrix_row1_y, f32 * outMatrix_row1_z, f32 * outMatrix_row2_x, f32 * outMatrix_row2_y, f32 * outMatrix_row2_z);
typedef void (*YmeGetCameraVerticalFOVRad)(void * ptrTo_m_app__App, f32 * outFOV);
typedef void (*YmeSetCameraVerticalFOVRad)(void * ptrTo_m_app__App, f32 FOV);
typedef void (*YmeDebugDrawLine)(void * ptrTo_m_app__App, f32 startX, f32 startY, f32 startZ, f32 stopX, f32 stopY, f32 stopZ, f32 color1R, f32 color1G, f32 color1B, f32 color1A, f32 color2R, f32 color2G, f32 color2B, f32 color2A);
typedef void (*YmeDeviceManagerGetWindowDimensions)(void * ptrTo_m_app__App, int * outWidth, int * outHeight);
typedef void (*YmeDeviceManagerGetDPIScaleInfo)(void * ptrTo_m_app__App, f32 * outScaleX, f32 * outScaleY);
typedef void (*YmeSceneGraphLeafGetName)(void * ptrTo_Leaf__donut_engine_SceneGraphLeaf, const char ** outName);
typedef void (*YmeSceneGraphLeafGetNode)(void * ptrTo_Leaf__donut_engine_SceneGraphLeaf, void ** out_p_Node__donut_engine_SceneGraphNode);
typedef void (*YmeSceneGraphLeafSetProperty)(void * ptrTo_Leaf__donut_engine_SceneGraphLeaf, const char * propertyName, f32 x, f32 y, f32 z, f32 w);
typedef void (*YmeSceneGraphNodeGetTranslation)(void * ptrTo_Node__donut_engine_SceneGraphNode, f64 * outX, f64 * outY, f64 * outZ);
typedef void (*YmeSceneGraphNodeGetRotation)(void * ptrTo_Node__donut_engine_SceneGraphNode, f64 * outX, f64 * outY, f64 * outZ, f64 * outW);
typedef void (*YmeSceneGraphNodeGetScaling)(void * ptrTo_Node__donut_engine_SceneGraphNode, f64 * outX, f64 * outY, f64 * outZ);
typedef void (*YmeSceneGraphNodeSetTranslation)(void * ptrTo_Node__donut_engine_SceneGraphNode, f64 x, f64 y, f64 z);
typedef void (*YmeSceneGraphNodeSetRotation)(void * ptrTo_Node__donut_engine_SceneGraphNode, f64 x, f64 y, f64 z, f64 w);
typedef void (*YmeSceneGraphNodeSetScaling)(void * ptrTo_Node__donut_engine_SceneGraphNode, f64 x, f64 y, f64 z);
typedef void (*YmeSceneGraphNodeSetTransform)(void * ptrTo_Node__donut_engine_SceneGraphNode, f64 tx, f64 ty, f64 tz, f64 rx, f64 ry, f64 rz, f64 rw, f64 sx, f64 sy, f64 sz);
typedef void (*YmeSceneGraphNodeInvalidateContent)(void * ptrTo_Node__donut_engine_SceneGraphNode);
typedef void (*YmeGetSceneGraphRootNode)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, void ** out_p_Node__donut_engine_SceneGraphNode);
typedef void (*YmeGetSceneGraphLightsCount)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 * outLightsCount);
typedef void (*YmeGetSceneGraphMaterialsCount)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 * outMaterialsCount);
typedef void (*YmeGetSceneGraphMeshesCount)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 * outMeshesCount);
typedef void (*YmeGetSceneGraphMeshInstancesCount)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 * outMeshInstancesCount);
typedef void (*YmeGetSceneGraphSkinnedMeshInstancesCount)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 * outSkinnedMeshInstancesCount);
typedef void (*YmeGetSceneGraphAnimationsCount)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 * outAnimationsCount);
typedef void (*YmeGetSceneGraphLight)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 index, void ** out_p_Light__donut_engine_Light);
typedef void (*YmeGetSceneGraphAllMaterialsUnordered)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, void ** outAllUnordered_p_Material__donut_engine_Material);
typedef void (*YmeGetSceneGraphMaterialByID)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, int materialID, void ** out_p_Material__donut_engine_Material);
typedef void (*YmeGetSceneGraphMaterialByName)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, const char * materialName, void ** out_p_Material__donut_engine_Material);
typedef void (*YmeGetSceneGraphAllMeshesUnordered)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, void ** outAllUnordered_p_Mesh__donut_engine_MeshInfo);
typedef void (*YmeGetSceneGraphMeshByName)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, const char * meshName, void ** out_p_Mesh__donut_engine_MeshInfo);
typedef void (*YmeGetSceneGraphMeshInstance)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 index, void ** out_p_MeshInstance__donut_engine_MeshInstance);
typedef void (*YmeGetSceneGraphSkinnedMeshInstance)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 index, void ** out_p_SkinnedMeshInstance__donut_engine_SkinnedMeshInstance);
typedef void (*YmeGetSceneGraphAnimation)(void * ptrTo_m_Scene__donut_engine_ExtendedScene, u64 index, void ** out_p_Animation__donut_engine_SceneGraphAnimation);
typedef void (*YmeLightGetType)(void * ptrTo_Light__donut_engine_Light, int * outLightType);
typedef void (*YmeLightGetPosition)(void * ptrTo_Light__donut_engine_Light, f64 * outX, f64 * outY, f64 * outZ);
typedef void (*YmeLightSetPosition)(void * ptrTo_Light__donut_engine_Light, f64 x, f64 y, f64 z);
typedef void (*YmeLightGetDirection)(void * ptrTo_Light__donut_engine_Light, f64 * outX, f64 * outY, f64 * outZ);
typedef void (*YmeLightSetDirection)(void * ptrTo_Light__donut_engine_Light, f64 x, f64 y, f64 z);
typedef void (*YmeMaterialGetStructData)(void * ptrTo_Material__donut_engine_Material, const char ** outMaterialName, void ** out_p_Material_domain__donut_engine_MaterialDomain, void ** out_p_Material_baseOrDiffuseColor_x__float3);
typedef void (*YmeMeshGetStructData)(void * ptrTo_Mesh__donut_engine_MeshInfo, const char ** outMeshName, u64 * outGeometriesCount, int * outGlobalMeshIndex);
typedef void (*YmeMeshGetGeometry)(void * ptrTo_Mesh__donut_engine_MeshInfo, u64 index, void ** out_p_Geometry__MeshGeometry, int * outGlobalGeometryIndex);
typedef void (*YmeGeometryGetMaterial)(void * ptrTo_Geometry__MeshGeometry, void ** out_p_Material__donut_engine_Material);
typedef void (*YmeMeshInstanceGetMesh)(void * ptrTo_MeshInstance__donut_engine_MeshInstance, void ** out_p_Mesh__donut_engine_MeshInfo);
typedef void (*YmeMeshInstanceGetInstanceIndex)(void * ptrTo_MeshInstance__donut_engine_MeshInstance, int * outInstanceIndex);
typedef void (*YmeMeshInstanceGetGeometryInstanceIndex)(void * ptrTo_MeshInstance__donut_engine_MeshInstance, int * outGeometryInstanceIndex);
typedef void (*YmeAnimationGetDuration)(void * ptrTo_Animation__donut_engine_SceneGraphAnimation, f32 * outDuration);
typedef void (*YmeAnimationIsValid)(void * ptrTo_Animation__donut_engine_SceneGraphAnimation, int * outIsValid);
typedef void (*YmeAnimationApply)(void * ptrTo_Animation__donut_engine_SceneGraphAnimation, f32 time, int * outOptionalIsSuccess);

typedef struct YmeFunctionPointers {
  YmeSetCurrentScene ymePtsdkSetCurrentScene;
  YmeGetCurrentScenePointer ymePtsdkGetCurrentScenePointer;
  YmeGetCurrentSceneName ymePtsdkGetCurrentSceneName;
  YmeSetCurrentSceneName ymePtsdkSetCurrentSceneName;
  YmeAppBaseSetAsynchronousLoadingEnabled ymePtsdkAppBaseSetAsynchronousLoadingEnabled;
  YmeAppBaseBeginLoadingScene ymePtsdkAppBaseBeginLoadingScene;
  YmeAppBaseIsSceneLoading ymePtsdkAppBaseIsSceneLoading;
  YmeAppBaseIsSceneLoaded ymePtsdkAppBaseIsSceneLoaded;
  YmeAppGetResolutionInfo ymePtsdkAppGetResolutionInfo;
  YmeCameraUpdate ymePtsdkCameraUpdate;
  YmeDonutMathRotationQuatFromEulerRad ymePtsdkDonutMathRotationQuatFromEulerRad;
  YmeDonutMathQuatToFloat3x3 ymePtsdkDonutMathQuatToFloat3x3;
  YmeGetCameraVerticalFOVRad ymePtsdkGetCameraVerticalFOVRad;
  YmeSetCameraVerticalFOVRad ymePtsdkSetCameraVerticalFOVRad;
  YmeDebugDrawLine ymePtsdkDebugDrawLine;
  YmeDeviceManagerGetWindowDimensions ymePtsdkDeviceManagerGetWindowDimensions;
  YmeDeviceManagerGetDPIScaleInfo ymePtsdkDeviceManagerGetDPIScaleInfo;
  YmeSceneGraphLeafGetName ymePtsdkSceneGraphLeafGetName;
  YmeSceneGraphLeafGetNode ymePtsdkSceneGraphLeafGetNode;
  YmeSceneGraphLeafSetProperty ymePtsdkSceneGraphLeafSetProperty;
  YmeSceneGraphNodeGetTranslation ymePtsdkSceneGraphNodeGetTranslation;
  YmeSceneGraphNodeGetRotation ymePtsdkSceneGraphNodeGetRotation;
  YmeSceneGraphNodeGetScaling ymePtsdkSceneGraphNodeGetScaling;
  YmeSceneGraphNodeSetTranslation ymePtsdkSceneGraphNodeSetTranslation;
  YmeSceneGraphNodeSetRotation ymePtsdkSceneGraphNodeSetRotation;
  YmeSceneGraphNodeSetScaling ymePtsdkSceneGraphNodeSetScaling;
  YmeSceneGraphNodeSetTransform ymePtsdkSceneGraphNodeSetTransform;
  YmeSceneGraphNodeInvalidateContent ymePtsdkSceneGraphNodeInvalidateContent;
  YmeGetSceneGraphRootNode ymePtsdkGetSceneGraphRootNode;
  YmeGetSceneGraphLightsCount ymePtsdkGetSceneGraphLightsCount;
  YmeGetSceneGraphMaterialsCount ymePtsdkGetSceneGraphMaterialsCount;
  YmeGetSceneGraphMeshesCount ymePtsdkGetSceneGraphMeshesCount;
  YmeGetSceneGraphMeshInstancesCount ymePtsdkGetSceneGraphMeshInstancesCount;
  YmeGetSceneGraphSkinnedMeshInstancesCount ymePtsdkGetSceneGraphSkinnedMeshInstancesCount;
  YmeGetSceneGraphAnimationsCount ymePtsdkGetSceneGraphAnimationsCount;
  YmeGetSceneGraphLight ymePtsdkGetSceneGraphLight;
  YmeGetSceneGraphAllMaterialsUnordered ymePtsdkGetSceneGraphAllMaterialsUnordered;
  YmeGetSceneGraphMaterialByID ymePtsdkGetSceneGraphMaterialByID;
  YmeGetSceneGraphMaterialByName ymePtsdkGetSceneGraphMaterialByName;
  YmeGetSceneGraphAllMeshesUnordered ymePtsdkGetSceneGraphAllMeshesUnordered;
  YmeGetSceneGraphMeshByName ymePtsdkGetSceneGraphMeshByName;
  YmeGetSceneGraphMeshInstance ymePtsdkGetSceneGraphMeshInstance;
  YmeGetSceneGraphSkinnedMeshInstance ymePtsdkGetSceneGraphSkinnedMeshInstance;
  YmeGetSceneGraphAnimation ymePtsdkGetSceneGraphAnimation;
  YmeLightGetType ymePtsdkLightGetType;
  YmeLightGetPosition ymePtsdkLightGetPosition;
  YmeLightSetPosition ymePtsdkLightSetPosition;
  YmeLightGetDirection ymePtsdkLightGetDirection;
  YmeLightSetDirection ymePtsdkLightSetDirection;
  YmeMaterialGetStructData ymePtsdkMaterialGetStructData;
  YmeMeshGetStructData ymePtsdkMeshGetStructData;
  YmeMeshGetGeometry ymePtsdkMeshGetGeometry;
  YmeGeometryGetMaterial ymePtsdkGeometryGetMaterial;
  YmeMeshInstanceGetMesh ymePtsdkMeshInstanceGetMesh;
  YmeMeshInstanceGetInstanceIndex ymePtsdkMeshInstanceGetInstanceIndex;
  YmeMeshInstanceGetGeometryInstanceIndex ymePtsdkMeshInstanceGetGeometryInstanceIndex;
  YmeAnimationGetDuration ymePtsdkAnimationGetDuration;
  YmeAnimationIsValid ymePtsdkAnimationIsValid;
  YmeAnimationApply ymePtsdkAnimationApply;
} YmeFunctionPointers;

typedef struct YmeData {
  void * ptrTo_g_ymeSplitScreenPlayersCount__int;
  void * ptrTo_g_ymeSplitScreenCurrentPlayerIndex__int;
  void * ptrTo_m_Window__GLFWwindow;
  void * ptrTo_m_IsNvidia__bool;
  void * ptrTo_m_app__App;
  u64 sizeof_struct__AppUIData;
  void * ptrTo_m_ui__AppUIData;
  void * ptrTo_m_Camera__donut_app_FirstPersonCamera;
  void * ptrTo_m_SceneTime__double;
  void * ptrTo_m_PickPosition_x__uint2;
  void * ptrTo_m_Pick__bool;
  void * ptrTo_m_PickFindMaterial__bool;
  void * ptrTo_m_FeedbackData__DebugFeedbackStruct;
  u64 sizeof_struct__DebugFeedbackStruct;
  u64 sizeof_struct__donut_render_TemporalAntiAliasingParameters;
  u64 sizeof_struct__EnvironmentMapImportanceSamplingParameters;
  u64 sizeof_struct__ToneMappingParameters;
  u64 sizeof_struct__OpacityMicroMapUIData;
  u64 sizeof_struct__AccelerationStructureUIData;
  u64 sizeof_struct__RtxdiUserSettings;
  u64 sizeof_struct__nrd_RelaxDiffuseSpecularSettings;
  u64 sizeof_struct__nrd_ReblurSettings;
  void * ptrTo_m_ui_TemporalAntiAliasingParams__donut_render_TemporalAntiAliasingParameters;
  void * ptrTo_m_ui_EnvironmentMapParams__EnvironmentMapImportanceSamplingParameters;
  void * ptrTo_m_ui_ToneMappingParams__ToneMappingParameters;
  void * ptrTo_m_ui_OpacityMicroMaps__OpacityMicroMapUIData;
  void * ptrTo_m_ui_AS__AccelerationStructureUIData;
  void * ptrTo_m_ui_RTXDI__RtxdiUserSettings;
  void * ptrTo_m_ui_RelaxSettings__nrd_RelaxDiffuseSpecularSettings;
  void * ptrTo_m_ui_ReblurSettings__nrd_ReblurSettings;
  void * ptrTo_m_ui_ResetAccumulation__bool;
  void * ptrTo_m_ui_EnableAnimations__bool;
  void * ptrTo_m_ui_LoopLongestAnimation__bool;
  void * ptrTo_m_ui_ShaderReloadRequested__bool;
  void * ptrTo_m_ui_ShaderReloadDelayedRequest__float;
  void * ptrTo_m_ui_EnvironmentMapParams_tintColor_x__float3;
  void * ptrTo_m_ui_EnvironmentMapParams_intensity__float;
  void * ptrTo_m_ui_EnvironmentMapParams_rotationXYZ_x__float3;
  void * ptrTo_m_ui_EnvironmentMapParams_enabled__bool;
  void * ptrTo_m_ui_RealtimeMode__bool;
  void * ptrTo_m_ui_AccumulationTarget__int;
  void * ptrTo_m_ui_ExperimentalPhotoModeScreenshot__bool;
  void * ptrTo_m_ui_RealtimeDenoiser__bool;
  void * ptrTo_m_ui_RealtimeAA__int;
  void * ptrTo_m_ui_RealtimeNoise__bool;
  void * ptrTo_m_ui_UseReSTIR__bool;
  void * ptrTo_m_ui_UseReSTIRGI__bool;
  void * ptrTo_m_ui_BounceCount__int;
  void * ptrTo_m_ui_RealtimeDiffuseBounceCount__int;
  void * ptrTo_m_ui_ReferenceDiffuseBounceCount__int;
  void * ptrTo_m_ui_ContinuousDebugFeedback__bool;
  void * ptrTo_m_ui_ShowDebugLines__bool;
  void * ptrTo_m_ui_DebugPixel_x__uint2;
  void * ptrTo_m_ui_MousePos_x__uint2;
  void * ptrTo_m_ui_EnableToneMapping__bool;
  void * ptrTo_m_ui_ToneMappingParams_exposureMode__unsigned;
  void * ptrTo_m_ui_ToneMappingParams_toneMapOperator__unsigned;
  void * ptrTo_m_ui_CameraAperture__float;
  void * ptrTo_m_ui_CameraFocalDistance__float;
  void * ptrTo_m_ui_ShowUI__bool;
  void * ptrTo_m_ui_EnableVsync__bool;
  void * ptrTo_m_ui_FPSLimiter__int;
  void * ptrTo_m_ui_AS_IsDirty__bool;
  void * ptrTo_m_ui_SelectedMaterialID__int;
  void * ptrTo_m_ui_SelectedInstanceIndex__int;
  void * ptrTo_m_ui_SelectedGeometryIndex__int;
  void * ptrTo_m_ui_RelaxSettings_historyFixFrameNum__unsigned;
  void * ptrTo_m_ui_RelaxSettings_specularPhiLuminance__float;
} YmeData;

YME_DECLSPEC const char * ymeGetHeader();
YME_DECLSPEC void ymeAppDonutLogCallback(int severity, const char * severityText, const char * message);
YME_DECLSPEC void ymeAppInitResolutionOverrideCallback(u32 * deviceParams_backBufferWidth, u32 * deviceParams_backBufferHeight, void * deviceParams_startFullscreen__bool);
YME_DECLSPEC void ymeAppInitCallback(const YmeFunctionPointers * functionPointers, const YmeData * data);
YME_DECLSPEC void ymeAppSceneLoadedOverrideInvisibleLightsCleanupCallback(int * doCleanup);
YME_DECLSPEC void ymeAppDearImguiInitFontSizeOverrideCallback(f32 * fontSize);
YME_DECLSPEC void ymeAppUiCallback(f32 * m_currentScale);
YME_DECLSPEC void ymeAppAnimateCallback(f32 fElapsedTimeSeconds);

